<!doctype html>
<?php
error_reporting(E_ALL ^ E_DEPRECATED);
include_once( "../autenticacion/Servicios.php" );
session_start();

// Conexion al servidor de la Base de datos
$modelo    = new Servicios();
$resGrilla = $modelo-> usuariosNoInvestigacion($_REQUEST['idInves']);


?>
<html>
	<head>
            <link rel="stylesheet" type="text/css" href="../css/styles.css">
            <link rel="stylesheet" type="text/css" href="../css/tablas.css">
        <link rel="stylesheet" type="text/css" href="../css/stiloinvestigador.css" />  
        <script type="text/javascript" language="javascript" src="../js/jquery-1.10.2.js"></script>
        <script type="text/javascript" language="javascript" src="../js/jquery.dataTables.js"></script> 
        <link rel="stylesheet" type="text/css" href="../css/jquery.dataTables.css">
        <link rel="stylesheet" href="../css/jquery-ui.css" />
        <script type="text/javascript" language="javascript" src="../js/jquery-ui.js"></script>
        <script src="../js/script.js"></script>
	  <script type="text/javascript" language="javascript" class="init">
	    $(document).ready(function() {
	      $('#participantes').dataTable(
	        {
	          'search': true,
	          "language": {
	              "lengthMenu": "_MENU_ registros por pagina",
	              "zeroRecords": "No hay datos.",
	              "info": "Pagina _PAGE_ de _PAGES_",
	              "infoEmpty": "No hay registros",
	              "infoFiltered": "(Total de registros _MAX_)",
	              "sInfoPostFix":   "",
	              "sSearch":        "Buscar:",
	              "sUrl":           "",
	              "sInfoThousands":  ",",
	              "sLoadingRecords": "Cargando...",
	              "oPaginate": {
	                  "sFirst":    "Primero",
	                  "sLast":    "Ultimo",
	                  "sNext":    "Siguiente",
	                  "sPrevious": "Anterior"
	              }
	          }
	        } 
	      );
	    });

	    function agregar(usuario){
	    	investigacion = $("#investigacion").val();

	    	$.post('../autenticacion/procesos.php', 
		      {
		        'Accion':  'agregarPar', 
		        'usuario': usuario,
		        'investi': investigacion
		      },
		      function(data){
		        alert(data);
		        location.reload();
		      }
		    );
	    }
	  </script>
	</head>
	<body>
		<input type="hidden" name="investigacion" id="investigacion" value="<?php echo $_REQUEST['idInves']; ?>">
		<table id="participantes" class="display" cellpadding="0" cellspacing="0" width="auto">
      <thead>
          <tr>
          		<th style="width:20px">&nbsp;</th>
          		<th style="width:80px">Tipo Doc</th>
              <th style="width:80px">Documento</th>
              <th>Usuario</th>
          </tr>
      </thead>
  
      <tbody>
        <?php

        while ( $rowGrilla =  mysql_fetch_array($resGrilla) ) {
        	$add = "<img src='../img/b_add.png' style='cursor:pointer' title='Agregar' onClick='agregar(".'"'.$rowGrilla['USU_CODIGO'].'"'.")' >";
           echo '<tr>
           				<td align="center">'.$add.'</td>
                  <td align="center">'.$rowGrilla['USU_TIPODOCUMENTO'].'</td>
                  <td align="center">'.$rowGrilla['USU_NUMERODOCUMENTO'].'</td>
                  <td>'.$rowGrilla['USU_NOMBRES'].' '.$rowGrilla['USU_APELLIDOS'].'</td>
                </tr> ';
        }
          ?>           
      </tbody>
    </table>

	</body>
</html>